﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Reflection;
using CARE.Web.Services;
using System.Windows.Ria.Data;

namespace CARE.Views
{
    public partial class NewElement : ChildWindow
    {
        GraphProvider gp = new GraphProvider();

        public NewElement()
        {
            InitializeComponent();
            ComboBoxColors.ItemsSource = EnumHelper.GetProperties<Colors>();
            var diseaseModelStateNames = gp.GetDiseaseModelStateNames();
            diseaseModelStateNames.Completed += new EventHandler(DiseaseModelStateNames_Completed);
        }

        public String NodeName
        {
            get
            {
                return Name.Text;
            }
        }

        public Color NodeColor
        {
            get
            {
                return (Color)typeof(Colors).GetProperty(ComboBoxColors.SelectedItem.ToString()).GetValue(null, null);
            }
        }

        public String StateClass
        {
            get
            {
                return ComboBoxStateNames.SelectedItem.ToString();
            }
        }

        void DiseaseModelStateNames_Completed(object sender, EventArgs e)
        {
            InvokeOperation<IEnumerable<String>> a = sender as InvokeOperation<IEnumerable<String>>;
            ComboBoxStateNames.ItemsSource = a.Value;
            ComboBoxStateNames.IsEnabled = true;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

